import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2022-11-26
 * Time: 21:45
 */
public class TestDemo {
    public static void main(String[] args) {
        
    }
    public static void main12(String[] args) {
        StringBuffer stringBuffer=new StringBuffer("wyb");
        stringBuffer.append(" I love you");
        System.out.println(stringBuffer);
    }
    public static void main11(String[] args) {
        StringBuilder  stringBuilder=new StringBuilder("123");
        stringBuilder.append(123);
        System.out.println(stringBuilder);


    }
    public static void main10(String[] args) {
        final int array[] = {1, 2, 3, 4, 5};
        array[0] = 10;
        System.out.println(Arrays.toString(array));
    }
    public static void main9(String[] args) {
        String str="    Back to me    ";
        System.out.println(str.trim());

    }
    public static void main8(String[] args) {
        String str="192\\168\\11.1";
        String []strings=str.split("\\\\");
        for ( String s:strings) {
            System.out.println(s);
        }
    }
    public static void main7(String[] args) {
        String str="192.168.1.1";
        //现在客户要求用/来分割
        String []strings=str.split("\\.");
        for ( String s:strings) {
            System.out.println(s);
        }
    }
    public static void main6(String[] args) {
        String str="Welcome to my world";
        String []strings=str.split(" ",3);
        for (String s:strings) {
            System.out.println(s);
        }
    }
    public static void main5(String[] args) {
        String str="Welcome to my world";
        String []strings=str.split(" ");
        for (String x  :strings) {
            System.out.println(x);
        }
    }
    public static void main4(String[] args) {
        String str="abacadar";
        System.out.println(str.replaceAll("a","p"));
        System.out.println(str.replaceFirst("a","w"));
    }
    public static void main3(String[] args) {
        String str="abcdefghijklmn";
        System.out.println(str.substring(9));
        System.out.println(str.substring(5,8));
    }
    public static void main2(String[] args) {
        String s = "hello";
// 字符串转数组
        char[] ch = s.toCharArray();
        for (int i = 0; i < ch.length; i++) {
            System.out.print(ch[i]);
        }
        System.out.println();
// 数组转字符串
        String s2 = new String(ch);
        System.out.println(s2);

    String string =String.format("%d-%d-%d",2022,11,28);
        System.out.println(string);
    }
    public static void main1(String[] args) {


      //数字转字符串
       String str=String.valueOf(123);
        System.out.println(str);
        //字符串转数组
        int data =Integer.parseInt("1314520");
        System.out.println(data);
        double data1=Double.parseDouble("12.35");
        System.out.println(data1);
        System.out.println("====");
        String str2="wyb";
        String str1=str2.toUpperCase();
        System.out.println(str1);
        System.out.println("====");
        String   s="WHY";
        String s1=s.toLowerCase();
        System.out.println(s1);

    }

}
